package com.renwei.yunlong.activity;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.Window;

import com.renwei.yunlong.R;
import com.renwei.yunlong.base.BaseActivity;
import com.renwei.yunlong.utils.ACache;


/**
 *
 * 启动页
 * Created by Administrator on 2017/8/22.
 */

public class WelcomeActivity extends BaseActivity {

    private final long SPLASH_LENGTH = 500;
    Handler handler = new Handler();
    private ACache mCache;
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        this.requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.activity_welcome);
        mCache = ACache.get(this);

        handler.postDelayed(new Runnable() {  //使用handler的postDelayed实现延时跳转

            public void run() {
                //判断是不是第一次进入、如果是进入引导页面、不是进入首页
                //PrefUtils.getBoolean()
                String mark = mCache.getAsString("mark");//标记（是否是新手）
                if (mark != null){
                    startActivity(new Intent(WelcomeActivity.this, LoginActivity.class));
                    finish();
                }else {
                    startActivity(new Intent(WelcomeActivity.this, GuideActivity.class));
                    finish();
                }
            }
        }, SPLASH_LENGTH);//500毫秒后跳转

    }
}
